package com.server.mongodb.domain;

import com.google.protobuf.ByteString;
import lombok.Data;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;
import java.util.List;

/**
 * 聊天消息结构类
 */
@Data
@Document("chat_history")
public class MGChatHistory {
    private String data; // 消息内容
    private boolean isImage; // 是否图片
    private Long sendUserUid; // 发送者uid
    private String sendUserHeadImage; // 发送者头像
    private String sendUserName; // 发送者名字
    private String getUserHeadImage; // 接收者头像
    private String getUserName; // 接收者名字
    private Long getUserUid; // 收到者uid
    private Date sendDate; // 发送的时间
    private boolean isRead; // 是否已读消息
    // 所有群消息的接收者都是群自己的uid
    private Long groupUid; // 如果是群消息,添加群uid,否则为空(此时这个也作为收到者的角色)
    private String groupName; // 如果是群消息,添加群昵称,否则为空
    private String groupHeadImage; // 如果是群消息,添加群头像,否则为空
    // 如果该消息被用户已读，则删掉List中对应的uid
    private List<Long> groupMemberUnreadUid; // 如果是群消息,存储目前未读该消息的群成员uid,否则为空

    public MGChatHistory(String data, boolean isImage, Long sendUserUid, String sendUserHeadImage, String sendUserName, String getUserHeadImage, String getUserName, Long getUserUid, Date sendDate, boolean isRead, Long groupUid, String groupName, String groupHeadImage, List<Long> groupMemberUnreadUid) {
        this.data = data;
        this.isImage = isImage;
        this.sendUserUid = sendUserUid;
        this.sendUserHeadImage = sendUserHeadImage;
        this.sendUserName = sendUserName;
        this.getUserHeadImage = getUserHeadImage;
        this.getUserName = getUserName;
        this.getUserUid = getUserUid;
        this.sendDate = sendDate;
        this.isRead = isRead;
        this.groupUid = groupUid;
        this.groupName = groupName;
        this.groupHeadImage = groupHeadImage;
        this.groupMemberUnreadUid = groupMemberUnreadUid;
    }

    public MGChatHistory() {
    }
}
